﻿using System;
using System.Windows.Forms;
using VSTranslate.Settings;

namespace VSTranslate
{
    //TODO: Refactoring with MVC!
    public partial class TranslateSettings : Form
    {
        public TranslateSettings()
        {
            InitializeComponent();
        }

        private void TranslateSettings_Load(object sender, EventArgs e)
        {
            chkIntegrateTools.Checked = SettingsManager.Instance.IntegrateWithTools;
            chkIntegrateCodeWindow.Checked = SettingsManager.Instance.IntegrateWithCodeWindowContextMenu;
        }

        private void chkIntegrateTools_CheckedChanged(object sender, EventArgs e)
        {
            //TODO: Refactoring!
            if (!chkIntegrateCodeWindow.Checked && !chkIntegrateTools.Checked)
            {
                chkIntegrateTools.Checked = true;
            }
            SettingsManager.Instance.IntegrateWithTools = chkIntegrateTools.Checked;
        }

        private void chkIntegrateCodeWindow_CheckedChanged(object sender, EventArgs e)
        {
            //TODO: Refactoring!
            if (!chkIntegrateCodeWindow.Checked && !chkIntegrateTools.Checked)
            {
                chkIntegrateCodeWindow.Checked = true;
            }
            SettingsManager.Instance.IntegrateWithCodeWindowContextMenu = chkIntegrateCodeWindow.Checked;
        }
    }
}